package com.icez.demo

import android.graphics.Path
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ImageView
import com.icez.demo.databinding.ItemLikeBinding
import com.icez.like_star_library.LikeStarLayout

class MainActivity : AppCompatActivity() {

    private val data = ArrayList<Int>()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val likeStar = findViewById<LikeStarLayout>(R.id.likeStar)
        val like = findViewById<ImageView>(R.id.like)

        data.clear()
        data.add(R.mipmap.like)
        data.add(R.mipmap.like1)
        data.add(R.mipmap.like2)
        data.add(R.mipmap.like3)
        data.add(R.mipmap.like4)
        data.add(R.mipmap.like5)


        like.setOnClickListener {
            likeStar.addItem<ItemLikeBinding>(R.layout.item_like){
                val index = (0 until data.size).random()
                it.itemLikeIv.setImageResource(data[index])
            }
        }
    }
}